package player.view.actions;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.KeyStroke;

import player.view.MainWindow;

public class CloseAction extends AbstractAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4943043951075819258L;

	private MainWindow owner;
	
	public CloseAction(MainWindow owner){
		this.setOwner(owner);
		putValue(NAME, "Close");
		putValue(SHORT_DESCRIPTION, "Izlazak iz aplikacije");
		putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.CTRL_MASK));
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		owner.dispose();
	}

	public void setOwner(MainWindow owner) {
		this.owner = owner;
	}

	public MainWindow getOwner() {
		return owner;
	}

}
